Skip to content

feat: export cookie utilities from undici#742

Merged
fengmk2 merged 2 commits intomasterfrom
copilot/export-getcookie-and-setcookie
Apr 16, 2026
Merged

feat: export cookie utilities from undici#742
fengmk2 merged 2 commits intomasterfrom
copilot/export-getcookie-and-setcookie

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

Re-export undici's Cookie API from urllib.

  • Export getCookies, setCookie, getSetCookies, deleteCookie, parseCookie functions and Cookie type from src/index.ts
  • Add tests for all five cookie utilities
import { getCookies, setCookie, getSetCookies, deleteCookie, parseCookie, Headers } from 'urllib';
import type { Cookie } from 'urllib';

const headers = new Headers();
setCookie(headers, { name: 'foo', value: 'bar' });
const cookies = getSetCookies(headers); // [{ name: 'foo', value: 'bar' }]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://registry.npmjs.org:80/urllib/latest
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/urllib/urllib/node_modules/.pnpm/@voidzero-dev+vite-plus-test@0.1.15_@arethetypeswrong+core@0.18.2_@types+node@22.19.15__7c6ae394869a5d43fd0cf7dc1d33dc1c/node_modules/@voidzero-dev/vite-plus-test/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/urllib/urllib/node_modules/.pnpm/@voidzero-dev+vite-plus-test@0.1.15_@arethetypeswrong+core@0.18.2_@types+node@22.19.15__7c6ae394869a5d43fd0cf7dc1d33dc1c/node_modules/@voidzero-dev/vite-plus-test/dist/workers/forks.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 12, 2026 that may be closed by this pull request
…eCookie and Cookie type from undici

Agent-Logs-Url: https://github.com/node-modules/urllib/sessions/ff57bdc1-581c-491f-94bc-7cfe12407c04

Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
Copilot AI changed the title [WIP] Export getCookie and setCookie from undici feat: export cookie utilities from undici Apr 12, 2026
Copilot AI requested a review from fengmk2 April 12, 2026 12:09
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 12, 2026

Open in StackBlitz

npm i https://pkg.pr.new/node-modules/urllib@742

commit: 5629627

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 12, 2026

Open in StackBlitz

npm i https://pkg.pr.new/node-modules/urllib@742

commit: 5629627

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.60%. Comparing base (ca63296) to head (5629627).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #742   +/-   ##
=======================================
  Coverage   94.60%   94.60%           
=======================================
  Files          10       10           
  Lines         723      723           
  Branches      226      226           
=======================================
  Hits          684      684           
  Misses         36       36           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fengmk2 fengmk2 marked this pull request as ready for review April 16, 2026 11:45
Copilot AI review requested due to automatic review settings April 16, 2026 11:45
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Apr 16, 2026

@codex review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes undici’s Cookie API through urllib’s public entrypoint so consumers can use cookie parsing/serialization helpers directly from urllib, along with adding basic unit tests to verify the re-exports behave as expected.

Changes:

  • Re-export undici cookie helpers (getCookies, setCookie, getSetCookies, deleteCookie, parseCookie) from src/index.ts.
  • Re-export undici’s Cookie type from src/index.ts.
  • Add tests covering the five cookie utilities and the Cookie type import.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/index.ts Adds re-exports for undici cookie utilities and the Cookie type from the package entrypoint.
test/index.test.ts Adds test coverage verifying the new cookie-related exports function correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 merged commit fdb513b into master Apr 16, 2026
22 checks passed
@fengmk2 fengmk2 deleted the copilot/export-getcookie-and-setcookie branch April 16, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export getCookie and setCookie from undici

3 participants